package com.ojoin.trade.t0loan_core.web.service.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ojoin.trade.common.exception.BusinessException;
import com.ojoin.trade.common.utils.CommonUtils;
import com.ojoin.trade.common.utils.LogUtils;
import com.ojoin.trade.common.web.dao.BaseDao;
import com.ojoin.trade.common.web.service.impl.BaseServiceImpl;
import com.ojoin.trade.t0loan_core.web.dao.TbIntentUserDao;
import com.ojoin.trade.t0loan_core.web.domain.TbIntentUser;
import com.ojoin.trade.t0loan_core.web.service.IntentUserBaseService;

@Service
public class IntentUserBaseServiceImpl extends
		BaseServiceImpl<TbIntentUser> implements IntentUserBaseService {
	
	@Autowired
	private TbIntentUserDao dao;
	
	private Logger log = LoggerFactory
			.getLogger(IntentUserBaseServiceImpl.class);

	@Override
	protected BaseDao<TbIntentUser> getBaseDao() {
		return dao;
	}

	@Override
	public int updateContactFlagByID(int[] ids, String memo, String contactflag)
			throws BusinessException {
		LogUtils.getT0loanLog().info("更新指定id对意向合作商户的状态值. ids->" + CommonUtils.getStrByIDs(ids) + ", contactflag->" + contactflag);
		
		return ((TbIntentUserDao) this
				.getBaseDao()).updateContactFlagByID(ids, memo, contactflag);
	}

	@Override
	public List<TbIntentUser> queryIntentUserListByContactflag(String contactflag)
			throws BusinessException {
		LogUtils.getT0loanLog().info("查询指定状态的意向合作商户列表. contactflag->" + contactflag);
		
		List<TbIntentUser> selectList = ((TbIntentUserDao) this
				.getBaseDao()).queryIntentUserListByContactflag(contactflag);
		if (selectList == null || selectList.size() == 0)
			return null;

		return selectList;
	}

	
}